﻿using System;
using System.ComponentModel.Composition.Hosting;
using System.Web.Routing;
using easytodoservice.Infrastructure;
using easytodoservice.Resources;
using Microsoft.ApplicationServer.Http.Activation;
using Microsoft.ApplicationServer.Http.Description;

namespace easytodoservice
{
    public class Global : System.Web.HttpApplication
    {

        protected void Application_Start(object sender, EventArgs e)
        {
            var catalog = new AssemblyCatalog(typeof(Global).Assembly);
            var container = new CompositionContainer(catalog);
            var config = HttpHostConfiguration.Create().
                SetResourceFactory(new ResourceFactory(container));

            RouteTable.Routes.MapServiceRoute<NotesResource>("Notes", config);
            RouteTable.Routes.MapServiceRoute<NoteResource>("Note", config);
        }

    }
}